<template>
  <div class="sy-container">
    <section class="gd1">
      <a class="hyzx_back" href="javascript:;" @click="back()"></a><h3>行业资讯</h3>
    </section>
    <section class="if1">
    </section>
    <section class="infoct">
      <ul class="nav">
        <li v-for="(data,id) in title.index.info.slice(0,3)" :key="id" :class="select==id?'select':''" @mouseover="select = id;select2=6;size='查看更多'">{{data.typename}}</li>
      </ul>
      <ul class="nr">
        <li v-for="(data,id) in title.index.info[select].info.slice(0,select2)" @click="tzzym(data.id,select)">
          <img :src="'https://exam.zhonghaiqihang.com/'+data.image">
          <div>
            <h4>{{data.title}}</h4>
            <p><span>{{data.createtime}}</span> <em>{{data.readnum}}</em></p>
          </div>
        </li>
      </ul>
      <a href="javascript:;" class="ck" style="margin-bottom: .6rem" @click="ckgd()">{{size}}</a>
    </section>
  </div>
</template>
<script>
  import axios from 'axios';
  import $ from 'jquery';
  // import Logo from '~/components/Logo.vue'
  export default {
    components: {
      // Logo
    },
    data(){
      return{
        datas:null,
        gjdata:['工商服务管家','财税服务管家','知识产权管家','人事社保管家','资质审批管家'],
        gjdt:0,
        select:0,
        select2:6,
        size:'查看更多',
        nav:['工商服务','财税服务','知识产权','人事社保','资质计算器']
      }
    },
    async asyncData ({ params }) {
    let nh = await axios.get(`https://exam.zhonghaiqihang.com/PInterface/Info/infoData`,{
      pramas:{
        num: '0'
      }
    });
    let data  = {index:nh.data};
    return { title: data}
  },
  head () {
    return {
      title: '创业攻略_解读政策_企业百科-企业邦',
      meta: [
        { hid: 'description', name: 'description', content: '企业邦-24小时免费服务:400-855-1888,为企业提供加急注册公司,提供注册地址,变更,注销,商标注册,公司转让,代理记账,国家局核名,疑难核名,解除税务异常,解公司地址异常,年报异常,公司收购,资质代办,建筑施工资质,总承包资质,专业承包资质,劳务资质,代办执照,北京公司户车指标,购车指标,车号,食品经营许可证,广播电视节目许可,联网资质,直播资质,人力资源劳务派遣,旅行社资质,知识产权代理,税收筹划等专业的全方位企业服务' },
        { hid: 'keywords', name: 'keywords',content: '北京公司注册,北京注册公司,北京代理记账,北京工商变更,北京公司注销,北京公司转让,回收公司,注册公司,公司注册,工商注册,公司变更,代理记账,公司转让,公司注销,公司收购,资质代办,代办执照,汽车指标,食品经营许可证 '}
      ]
    }
  },
  mounted:function(){
  	    $(document).ready(function(){
      $('.tbnava5').removeClass('select');
      $('.tbnava6').addClass('select');
    })
    document.getElementById('head').style.display = 'none';

    var _this = this;

    if(this.$route.query.name){
      this.select = this.$route.query.name;
    }

    if(this.select2<this.title.index.info[0].countnum){
      //
      for(let i=this.select2;i<this.title.index.info[0].countnum;i+=6){
        axios.get('https://exam.zhonghaiqihang.com/'+'PInterface/Info/infoData',{
          params:{
            num:i
          }
        })
          .then(function(response){

            for (let i = 0;i<6;i++){
              if(response.data.info[0].info[i]!=undefined){
                _this.title.index.info[0].info.push(response.data.info[0].info[i]);
              }
              if(response.data.info[1].info[i]!=undefined){
                _this.title.index.info[1].info.push(response.data.info[1].info[i]);
              }
              if(response.data.info[2].info[i]!=undefined){
                _this.title.index.info[2].info.push(response.data.info[2].info[i]);
              }

            }
          });
      }

    }
    function IsPC() {
      var userAgentInfo = navigator.userAgent;
      var Agents = ["Android", "iPhone",
        "SymbianOS", "Windows Phone",
        "iPad", "iPod"];
      var flag = true;
      for (var v = 0; v < Agents.length; v++) {
        if (userAgentInfo.indexOf(Agents[v]) > 0) {
          flag = false;
          break;
        }
      }
      return flag;
    }
    if(IsPC()){
      this.$router.push('/Info');

    }else{

    }

  },
  methods:{
    ckgd:function(){
      if(this.select == 0){
        if(this.select2<this.title.index.info[0].countnum){
          this.select2 +=6;
        }else{
          this.size = '没有更多数据了';
        }
      }else if(this.select == 1){
        if(this.select2<this.title.index.info[1].countnum){
          this.select2 +=6;
        }else{
          this.size = '没有更多数据了';
        }
      }else   if(this.select == 2){
        if(this.select2<this.title.index.info[2].countnum){
          this.select2 +=6;
        }else{
          this.size = '没有更多数据了';
        }
      }

    },
    tzzym:function(e,e2){
      this.$router.push('/Mobile/Details/'+e+'?name='+e2);
    },
    back:function(){
      this.$router.go(-1);
    }

  }

  }
</script>

<style>

</style>
